package com.czp.audit.mapper.impl;

import java.util.List;

import org.apache.ibatis.session.RowBounds;

import com.czp.audit.mapper.IAuditMapper;
import com.czp.audit.model.AuditProcess;
import com.czp.audit.model.AuditType;
import com.czp.framework.mapper.BaseMapperSupport;

/**
 * 【环 境】：J2SE 1.7
 * @author   柴志鹏	CHAIZP@GMAIL.COM
 * @version  version 1.0
 * @since    2014-11-13
 */
public class AuditMapperImpl extends BaseMapperSupport implements IAuditMapper {

	public List<AuditType> queryAuditTypeList(AuditType at, RowBounds br) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.audit.mapper.IAuditMapper.queryAuditTypeList", at, br);
	}
	
	public int queryAuditTypeCount(AuditType at) throws Exception {
		return this.getSqlSession().selectOne(
				"com.czp.audit.mapper.IAuditMapper.queryAuditTypeCount", at);
	}

	public List<AuditProcess> queryAuditProcessListByTypeId(String typeId, RowBounds rb)
			throws Exception {
		return getSqlSession().selectList(
				"com.czp.audit.mapper.IAuditMapper.queryAuditProcessListByTypeId", typeId, rb);
	}

	public int sortProcess(AuditProcess ap) throws Exception {
		return getSqlSession().update(
				"com.czp.audit.mapper.IAuditMapper.sortProcess", ap);
	}

	public int deleteAuditType(AuditType at) throws Exception {
		return getSqlSession().delete(
				"com.czp.audit.mapper.IAuditMapper.deleteAuditType", at);
	}

	public int insertAuditType(AuditType at) throws Exception {
		return getSqlSession().insert(
				"com.czp.audit.mapper.IAuditMapper.insertAuditType", at);
	}

	public int updateAuditType(AuditType at) throws Exception {
		return getSqlSession().update(
				"com.czp.audit.mapper.IAuditMapper.updateAuditType", at);
	}

	public List<AuditProcess> getOptionallyProcess(String typeId) throws Exception {
		return getSqlSession().selectList(
				"com.czp.audit.mapper.IAuditMapper.getOptionallyProcess", typeId);
	}
	
	public List<AuditProcess> getSelectedProcess(String typeId) throws Exception {
		return getSqlSession().selectList(
				"com.czp.audit.mapper.IAuditMapper.getSelectedprocess", typeId);
	}
	
	public int getSelectedCountByTypeId(String typeId) throws Exception {
		return getSqlSession().selectOne(
				"com.czp.audit.mapper.IAuditMapper.getSelectedCountByTypeId", typeId);
	}

	public int deleteAuditProcessByTypeId(String typeId) throws Exception {
		return getSqlSession().delete(
				"com.czp.audit.mapper.IAuditMapper.deleteAuditProcessByTypeId", typeId);
	}

	public int addSelectedJob(AuditProcess ap) throws Exception {
		return getSqlSession().insert(
				"com.czp.audit.mapper.IAuditMapper.addSelectedJob", ap);
	}
	
	public List<AuditType> testProcess(String id) {
		return getSqlSession().selectList("com.czp.audit.mapper.IAuditMapper.testProcess", id);
	}
	
}
